package wei.xinya.core.string;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        String a = "ab"; // a 为一个引用
        String b = "ab"; // b为另一个引用,对象的内容一样
        String aa = "ab"; // 放在常量池中
        String bb = "ab"; // 从常量池中查找
        if (aa == bb) // true
            System.out.println("aa==bb");
        if (a == b) // false，非同一对象
            System.out.println("a==b");
        if (a.equals(b)) // true
            System.out.println("aEQb");
        if (42 == 42.0) { // true
            System.out.println("true");
        }

        try {
            Scanner input = new Scanner(System.in);
            String s  = input.nextLine();
            System.out.println(s);
            BufferedReader inputStr = new BufferedReader(new InputStreamReader(System.in));
            System.out.println(inputStr.readLine());
            input.close();
        }catch (IOException e){
            System.out.println(e.getMessage());
        }
    }
}
